﻿@using RTW.Model;
@model List<SysHomeMenu>;
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewData["Title"] = "湖北省检察院档案管理系统 - 主页";
}
@section Head{
    <link rel="stylesheet" href="~/layuiadmin/style/style.css" media="all" asp-append-version="true">
}

    <div id="dMain">
        @*<div class="layui-col-md4" style="padding: 10px;">
            <div class="layui-card">
                <div class="layui-card-header" style="font-weight: bold;">个人资料</div>
                <div class="layui-card-body">
                    <div class="ibox-content">
                        <div class="layui-col-md4">
                            <div class="text-center">
                                <img class="layui-circle" alt="image" src="~/layuiadmin/layui/images/Chimpanzee.png" style="border: 1px solid #ddd;width: 68px;height: 68px;padding: 5px;margin-top: 5px;" />
                                <div class="font-bold" style="margin-top: 5px;">系统管理员</div>
                            </div>
                        </div>
                        <div class="layui-col-md8">
                            <h3 style="font-size: 16px;margin-bottom: 10px;"><strong>管理员</strong></h3>
                            <p><strong>湖北省人民检察院</strong></p>
                            <p><strong>档案系统管理</strong></p>
                            <p>Tel:88888888</p>
                        </div>
                        <a class="layui-btn layui-btn-xs layui-btn-warm" style="float: right;"><i class="layui-icon layui-icon-edit"></i>编辑</a>
                    </div>
                </div>
            </div>
        </div>*@
        <div class="layui-col-md12" style="padding: 10px;">
            <div class="layui-card">
                <div class="layui-card-header" style="font-weight: bold;">档案统计</div>
                <div class="layui-card-body">
                    <div class="ibox-content" id="dContent2">
                        @foreach (var item in Model)
                        {
                            @if (item.HMZT == "1")
                            {
                                <div class="layui-col-md3" style="padding:0 10px">
                                    <div class="widget  style1" style="background-color:@item.HMYS;color:white;">
                                        <div class="layui-row">
                                            <div class="layui-col-xs4">
                                                <i class="layui-icon @item.HMTX fa-5x"></i>
                                            </div>
                                            <div class="layui-col-xs8 text-right">
                                                <span id="@item.HMID">@item.HMMC</span>
                                                <h2 class="font-bold">19051</h2>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            }
                        }

                    </div>
                </div>
            </div>
        </div>

        <div class="layui-col-md4" style="padding: 10px;">
            <div class="layui-card">
                <div class="layui-card-header">
                    <span style="font-weight: bold;">最新动态</span>
                    <span style="float:right;">
                    @if (ViewBag.TMsg.Count != 0)
                    {
                        <button type="button" class="layui-btn layui-btn-xs layui-btn-danger HomeZxdtBtnMan">全部标为已读</button>
                    }
                    </span>
                </div>
                <div class="layui-card-body HomeZxdtbody">
                    @foreach (var item in ViewBag.TMsg)
                    {
                        <dl class="layuiadmin-card-status layuiadmin-card-status-zxdt">
                            <dd>
                                <div class="layui-status-img"><a href="javascript:;"><img src="../../layuiadmin/style/res/logo.png"></a></div>
                                <div class="HomePage_zxdt_content">
                                    <button type="button" class="layui-btn layui-btn-xs layui-btn-danger HomeZxdtBtn" value="@item.ID">已读</button>
                                    <p>@item.MsgTitle</p>
                                    @{
                                        string Msginfo = item.MsgInfo == null ? "" : item.MsgInfo;
                                        string[] MsgInfoZ = new string[10];
                                        if (Msginfo.IndexOf(',') > 0)
                                        {
                                            MsgInfoZ = Msginfo.Split(',');
                                            foreach (string itema in MsgInfoZ)
                                            {
                                                <p>@itema</p>
                                            }
                                        }
                                        TimeSpan timeSpan =item.AddTime!=null? DateTime.Now.Subtract(item.AddTime):DateTime.Now;
                                    }
                                    <span class="layui-input-right">
                                        @if (timeSpan.Days != 0)
                                        {
                                            @timeSpan.Days;
                                            <span>天前</span>
                                        }
                                        else if (timeSpan.Hours != 0)
                                        {
                                            @timeSpan.Hours;
                                            <span>小时前</span>
                                        }
                                        else if (timeSpan.Hours != 0)
                                        {
                                            @timeSpan.Minutes;
                                            <span>分钟前</span>
                                        }
                                        else if (timeSpan.Seconds != 0)
                                        {
                                            @timeSpan.Minutes;
                                            <span>秒前</span>
                                        }
                                    </span>
                                </div>
                            </dd>
                        </dl>
                    }
                    @if (ViewBag.TMsg.Count == 0)
                    {
                        <dl style="line-height:100px;">
                            <dd>
                                <h2 style="text-align:center;">暂无通知</h2>
                            </dd>
                        </dl>
                    }
                    else
                    {
                        <dl style="line-height:100px;display:none">
                            <dd>
                                <h2 style="text-align:center;">暂无通知</h2>
                            </dd>
                        </dl>
                    }
                </div>
            </div>
        </div>
        <div class="layui-col-md4" style="padding: 10px;">
            <div class="layui-card">
                <div class="layui-card-header" style="font-weight: bold;">库房示意图</div>
                <div class="layui-card-body">
                    
                </div>
            </div>
        </div>
        <div class="layui-col-md4" style="padding: 10px;">
            <div class="layui-card">
                <div class="layui-card-header" style="font-weight: bold;">插件</div>
                <div class="layui-card-body synthesize">
                    @foreach(var item in ViewBag.list1)
                    {
                    <p>
                        <i class="layui-icon layui-icon-download-circle"></i>
                        <a href="@item.FullName.Substring(item.FullName.IndexOf(@"\layuiadmin\download"))">@item.Name.ToString()<span class="text-danger">(插件下载)</span></a>
                    </p>   
                    }
                </div>
            </div>

            <div class="layui-card">
                <div class="layui-card-header" style="font-weight: bold;">驱动</div>
                <div class="layui-card-body synthesize">
                    @foreach (var item in ViewBag.list2)
                    {
                        <p>
                            <i class="layui-icon layui-icon-download-circle"></i>
                            <a href="@item.FullName.Substring(item.FullName.IndexOf(@"\layuiadmin\download"))">@item.Name.ToString()<span class="text-danger">(操作说明)</span></a>
                        </p>
                    }
                </div>
            </div>

            <div class="layui-card">
                <div class="layui-card-header" style="font-weight: bold;">工具</div>
                <div class="layui-card-body synthesize">
                    @foreach (var item in ViewBag.list3)
                    {
                        <p>
                            <i class="layui-icon layui-icon-download-circle"></i>
                            <a href="@item.FullName.Substring(item.FullName.IndexOf(@"\layuiadmin\download"))">@item.Name.ToString()<span class="text-danger">(插件下载)</span></a>
                        </p>
                    }
                </div>
            </div>

            <div class="layui-card">
                <div class="layui-card-header" style="font-weight: bold;">文档</div>
                <div class="layui-card-body synthesize">
                    @foreach (var item in ViewBag.list4)
                    {
                        <p>
                            <i class="layui-icon layui-icon-download-circle"></i>
                            <a href="@item.FullName.Substring(item.FullName.IndexOf(@"\layuiadmin\download"))">@item.Name.ToString()<span class="text-danger">(插件下载)</span></a>
                        </p>
                    }
                </div>
            </div>
        </div>


        <div class="layui-clear"></div>
    </div>

@section scripts{
    <script>
        layui.use(['element', 'jquery', 'layer'], function () {
            var element = layui.element, $ = layui.jquery, layer = layui.layer;

            $(".HomeZxdtBtn").click(function () {
                var idstring = $(this).val();
                var thishtml = $(this).parents(".layuiadmin-card-status-zxdt");
                thishtml.slideToggle()
                $.post(
                    "/Home/SetHome",
                    { ID: idstring },
                    function (data) {
                        if (data == false) {
                            thishtml.slideToggle() 
                        }
                    },
                    'json'  
                )
            })
            $(".HomeZxdtBtnMan").click(function () {
                layer.open({
                    content: '是否将全部消息已读!',
                    btn: ['确定', '取消'],
                    btn1: function (index, layero) {
                        layer.close(index);
                        $(".HomeZxdtbody").slideToggle();
                        $.post("/Home/SetHomeMan")
                    }, btn2: function (index, layero) {
                        layer.close(index);
                    }
                })
               
            })
        });
    </script>
}
